const router = require('koa-router')()

const {kpi} =require('../model')
//获取数据

  router.post('/kpi/getAll', async (ctx, next) => {
    // 获取全部数据
    const res = await kpi.find();
    if (res) {
      ctx.body = {
        code: 200,
        msg: '获取全部数据成功',
        data: res
      }
    } else {
      ctx.body = {
        code: 404,
        msg: '未找到数据'
      }
    }
  })

module.exports = router
